#pragma once

#include <iostream>
#include <deque>
#include<list>
#include<vector>
namespace aoqiang
{
    template <class T, class Container = std::deque<T>>
    class stack
    {
    public:
        stack()
        {
        }
        ~stack()
        {
        }
        void push(const T &x)
        {
            con_.push_back(x);
        }
        void pop()
        {
            con_.pop_back();
        }
        T &top()
        {
            return con_.back();
        }
        size_t size()
        {
            return con_.size();
        }
        bool empty()
        {
            return con_.empty();
        }

    private:
        Container con_;
    };

    void test_stack()
    {
        stack<int, std::vector<int>> st1;
        // stack<int> st1;
        st1.push(1);
        st1.push(2);
        st1.push(3);
        st1.push(4);

        while (!st1.empty())
        {
            std::cout << st1.top() << " ";
            st1.pop();
        }
        std::cout << std::endl;

        stack<int, std::list<int>> st2;
		st2.push(1);
		st2.push(2);
		st2.push(3);
		st2.push(4);

		while (!st2.empty())
		{
			std::cout << st2.top() << " ";
			st2.pop();
		}
		std::cout << std::endl;
	}
}